package 牛客;

public class 最大数 {
    public static String solve (int[] nums) {
        // write code here
        for(int i=0;i<nums.length;i++){
            for(int j=0;j<nums.length-i-1;j++){
                String a=String.valueOf(nums[j])+String.valueOf(nums[j+1]);
                String b=String.valueOf(nums[j+1])+String.valueOf(nums[j]);
                if(Integer.valueOf(b)>Integer.valueOf(a)){
                    int t=nums[j];
                    nums[j]=nums[j+1];
                    nums[j+1]=t;
                }

            }

        }
        StringBuilder a =new StringBuilder();
        for(int i=0;i<nums.length;i++){
           a.append( String.valueOf(nums[i]));
        }
        return a.toString();
    }

    public static void main(String[] args) {
        int []a={2,20,23,4,8};
        System.out.println(solve(a));
    }
}
